const mongoose = require('mongoose');
const reg = require('../utils/reg');
const path = require('path');
// 密码加密
const bcrypt = require('../utils/bcrypt');

const UserModel = require('./UserModel');

// 5.创建文档的结构对象(设置对象数据类型格式)
let Friend = new mongoose.Schema({
  creationTime: {//创建时间 毫秒
    type: Number,
    default: new Date(),
    required: true, //判断该字段必填
  },
  friend_phone: {//好友手机号码
    type: String,
  },
  friend_id: {//好友id
    type: mongoose.SchemaTypes.ObjectId,
    ref: 'user',
  },
  user_id: {//用户本人id
    type: mongoose.SchemaTypes.ObjectId,
    ref: 'user'
  }
});
// 6.创建模型对象
let FriendModel = mongoose.model('friend', Friend);

module.exports = FriendModel
